package utils;
import java.io.File;
import java.io.FileOutputStream;
import java.util.Properties;

/**
 * Classe per la gestione delle property del DataBase Mysql
 * @author cristina
 *
 */
public class ConfigurationProperties extends Properties {
	private static final long serialVersionUID = 1L;
	private File _configFile;

	public ConfigurationProperties() {
		super();
		_configFile = new File(getConfigFile());
			_configFile.getParentFile().mkdirs();
			setProperty("dbtype", "mysql");
			setProperty("driver", "com.mysql.jdbc.Driver");
			setProperty("dbname", "dbcinema");
			setProperty("host", "localhost");
			setProperty("port", "3306");
			setProperty("user", "valentina");
			setProperty("pass", "noemi2002");
			try {
				store(new FileOutputStream(getConfigFile()), "database configuration");
			} catch (Exception e) {
				e.printStackTrace();
			}
	}

	public static String getConfigFile() {
		return getConfigDir() + "/database.config.properties";
	}

	public static String getConfigDir() {
		return "./conf";
	}
	
}
